package com.sky.config;

import com.sky.properties.FileUploadProperties;
import com.sky.utils.UploadUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，用于创建uploadUtil对象
 */
@Configuration
@Slf4j
public class UploadConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public UploadUtil uploadUtil(FileUploadProperties fileUploadProperties){
        log.info("开始创建upload文件上传对象:{}",fileUploadProperties);
        return new UploadUtil(fileUploadProperties.getUploadDir());
    }
}
